<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
//引入lession
use App\Admin\Lession;
//引入input
use Input;
class LessionController extends Controller
{
    //列表操作
    public function index(){
    	//查询数据
    	$data = Lession::orderBy('sort','desc') -> get();
    	//展示视图
    	return view('admin.lession.index',compact('data'));
    }

    //播放视频
    public function play(){
    	//获取视频id
    	$video_id = Input::get('id');
    	//获取视频的播放地址
    	$video_addr = Lession::where('id','=',$video_id) -> value('video_addr');
    	//输出播放器
    	return "<video src='$video_addr' controls='controls' width='100%'>你的浏览器不支持video标签</video>";
    }
}
